dir1 = ('./figure/');

% tic
% for i = 1501:3000
%     
%     load([saldir 'dat',sprintf('%4.4d',i)]);
%     spe1d_fix_p_mod;
%     vx(1:nx,2:ny-1)=-dy1p5*(phii(1:nx,3:ny)-phii(1:nx,1:ny-2));
%     hf = mean(vx(:,2:end-1).*Ti(:,2:end-1),2);
%     
% 
%     fig = figure;
%     plot(xx,hf);
%     title(['hf,t=' num2str(i)],'FontSize',15); xlabel('x','FontSize',15);
%     frame = getframe(fig);
%     img = frame2im(frame);
%     imwrite(img,[dir1 'hf' num2str(i) '.png']);
%     close
% end
% toc
load('./data/initial.mat')

% for i = 1:nts
i = 800;
    load([saldir 'dat',sprintf('%4.4d',i)]);
    % T0f = smooth(T0i(:,4),40);
    % plot(T0i(:,19),'-o');
    % spe1d_fix_p_mod;
    vx = zeros(nx,ny);
    vx(1:nx,2:ny-1)=-dy1p5*(phii(1:nx,3:ny)-phii(1:nx,1:ny-2));
    hf = mean(vx(:,2:end-1).*Ti(:,2:end-1),2);

    hfcond = -0.5*diff(T0i)/dx;
    fig = figure;
    plot(xx(1:end-1),hfcond(:,10),'r');
    
    hold on
    plot(xx(1:end-1),hf(1:end-1),'k');
    legend('热传导','对流')

    xlabel('x')
    title(['Heatflux,t=' num2str(i)]);
    frame = getframe(fig);
    img = frame2im(frame);
    imwrite(img,[dir1 'T0' num2str(i) '.png']);
    close
% end

% fig = figure;
% plot(xx,hf);
% title(['hf,t=' num2str(i)],'FontSize',15); xlabel('x','FontSize',15);
% frame = getframe(fig);
% img = frame2im(frame);
% imwrite(img,[dir1 'hf' num2str(i) '.png']);
% close
